package com.ruoyi.predict2.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.predict2.domain.BoleScriptPredictionRecord2;
import com.ruoyi.predict2.service.IBoleScriptPredictionRecord2Service;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 岗位预测记录Controller
 * 
 * @author ruoyi
 * @date 2025-08-17
 */
@RestController
@RequestMapping("/trainScript/record2")
public class BoleScriptPredictionRecord2Controller extends BaseController
{
    @Autowired
    private IBoleScriptPredictionRecord2Service boleScriptPredictionRecord2Service;

    /**
     * 查询岗位预测记录列表
     */
    @PreAuthorize("@ss.hasPermi('trainScript:record2:list')")
    @GetMapping("/list")
    public TableDataInfo list(BoleScriptPredictionRecord2 boleScriptPredictionRecord2)
    {
        startPage();
        List<BoleScriptPredictionRecord2> list = boleScriptPredictionRecord2Service.selectBoleScriptPredictionRecord2List(boleScriptPredictionRecord2);
        return getDataTable(list);
    }

    /**
     * 导出岗位预测记录列表
     */
    @PreAuthorize("@ss.hasPermi('trainScript:record2:export')")
    @Log(title = "岗位预测记录", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, BoleScriptPredictionRecord2 boleScriptPredictionRecord2)
    {
        List<BoleScriptPredictionRecord2> list = boleScriptPredictionRecord2Service.selectBoleScriptPredictionRecord2List(boleScriptPredictionRecord2);
        ExcelUtil<BoleScriptPredictionRecord2> util = new ExcelUtil<BoleScriptPredictionRecord2>(BoleScriptPredictionRecord2.class);
        util.exportExcel(response, list, "岗位预测记录数据");
    }

    /**
     * 获取岗位预测记录详细信息
     */
    @PreAuthorize("@ss.hasPermi('trainScript:record2:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(boleScriptPredictionRecord2Service.selectBoleScriptPredictionRecord2ById(id));
    }

    /**
     * 新增岗位预测记录
     */
    @PreAuthorize("@ss.hasPermi('trainScript:record2:add')")
    @Log(title = "岗位预测记录", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody BoleScriptPredictionRecord2 boleScriptPredictionRecord2)
    {
        return toAjax(boleScriptPredictionRecord2Service.insertBoleScriptPredictionRecord2(boleScriptPredictionRecord2));
    }

    /**
     * 修改岗位预测记录
     */
    @PreAuthorize("@ss.hasPermi('trainScript:record2:edit')")
    @Log(title = "岗位预测记录", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody BoleScriptPredictionRecord2 boleScriptPredictionRecord2)
    {
        return toAjax(boleScriptPredictionRecord2Service.updateBoleScriptPredictionRecord2(boleScriptPredictionRecord2));
    }

    /**
     * 删除岗位预测记录
     */
    @PreAuthorize("@ss.hasPermi('trainScript:record2:remove')")
    @Log(title = "岗位预测记录", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(boleScriptPredictionRecord2Service.deleteBoleScriptPredictionRecord2ByIds(ids));
    }
}
